﻿#region Disclaimer/Info
///////////////////////////////////////////////////////////////////////////////////////////////////
// MetaCollection
// 
// MetaCollection is a system to provide a standard structure, permissions and metadata service
// for content organization.
//
// This project is hosted at Google Code at http://code.google.com/p/metacollection/
//
// This project is licensed under the BSD license.  See the License.txt file for more information.
///////////////////////////////////////////////////////////////////////////////////////////////////
#endregion

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using MetaCollection.Framework.Model;

namespace MetaCollection.Framework.Repository
{
	/// <summary>
	/// Classes that implement the <see cref="IResourceRepository"/> provide the storage
	/// implementation for items in the MetaCollection.  Implementations of this interface
	/// are used by ResourceProviders to give flexibility in deployment.  In some scenarios
	/// it may be appropriate to use the file system for storage of items while others may
	/// wish to use a database.
	/// </summary>
	public interface IResourceRepository : IRepository
	{
		/// <summary>
		/// Gets the resource stream for the given item.
		/// </summary>
		/// <param name="item">The item to get the resource stream for</param>
		/// <returns>A stream to read the item's resource from</returns>
		Stream GetResourceStream(IItemInstance item);

		/// <summary>
		/// Saves the resource stream provided for the given item.
		/// </summary>
		/// <param name="item">The item associated with this resource stream.</param>
		/// <param name="data">The data to save as the resource for this item.</param>
		void SaveResourceStream(IItemInstance item, Stream data);
	}
}
